<?
session_start(); 
include("./includes/functions.php");

if(isset($_COOKIE['login']) && $_COOKIE['login'] != '' ||(isset($_SESSION['slogin']) && $_SESSION['slogin'] == '1') )
{
	//echo $_COOKIE['login'];
	if(isset($_COOKIE['login']) && $_COOKIE['login']== 1)
	{
		//setcookie('login', '1', time()- 500);
		$_SESSION['slogin'] = '1';		
	}
	define('TPL_DIR','templates/site/');
	define('SRC_DIR','sources/site/');
	define('CLASS_DIR','class/');
	
	
	//include("./includes/functions.php");
	include("./includes/va_db.php");
	include("./includes/config.php");
	include("./includes/constant.php");
	include("./class/categories.class.php");
	include("./kam/admin/function.php");
	
	include(CLASS_DIR.'bao_tri.class.php');
	include(CLASS_DIR."info.class.php");
	include(CLASS_DIR."yahoo.class.php");
	include(CLASS_DIR."skype.class.php");
	include(CLASS_DIR."template.php");
	include(CLASS_DIR."cart.class.php");
	include("ckeditor_config.php");
	$CKEditor->config['width'] = 600;
	$CKEditor->config['height'] = 300;
	
	$do   = isset($_GET["do"])  ? $_GET["do"] :'main';
	$act   = isset($_GET["act"])  ? $_GET["act"]  : "";
	$page   = isset($_GET["page"])  ? $_GET["page"]  : '1';//for paging
	
	$file_php = "./kam/modules/".$do."/admin/$do.php";
	if (!file_exists($file_php)){
		$msg="There is not this function!!!";
		$p='./123.php';
	
		page_transfer($msg,$p);
	}
	else{
		require($file_php);
	}
	include("./kam/admin/admin-pro.php");
}
else
{
	$page = "./login-admin.html";
	$msg = "Bạn Vui Lòng Đăng Nhập";
	page_transfer_admin($msg,$page);
}
?>
